<template>
	<view>
		<view class="goodsWrap" v-for="item in indexGoodslist" :key="item.id">
			<view class="title">
				<image :src="item.titleImg" mode=""></image>
			</view>
			<view class="main">
				<view class="item" v-for="item1 in item.childInfo" :key="item1.goods_id" @click="handleId(item1.goods_id)">
					<view class="pic">
						<image :src="item1.goodsUrl" mode="widthFix"></image>
					</view>
					<view class="goodsName">{{item1.goodsName}}</view>
					<view class="goodsDesc">{{item1.goodsDesc}}</view>
					<view class="goodsPrice">￥{{item1.goodsPrice}}</view>
					<view class="butBtn">立即购买</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"uni-index-goods",
		props:{
			indexGoodslist:Array
		},
		data() {
			return {
				
			};
		},
		methods:{
			handleId(id){
				uni.navigateTo({
					url:"../../pages/detail/detail?goods_id=" + id
				})
			}
		}
	}
</script>

<style lang="less">
	.goodsWrap{
		.title{
			image{
				width: 100%;
			}
		}
		.main{
			display: flex;
			flex-wrap: wrap;
			.item{
				width: 50%;
				padding: 10rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				.pic{
					width: 100%;
					image{
						width: 100%;
					}
				}
				.goodsName{
					font-size: 28rpx;
					font-weight: bold;
					}
				.goodsDesc{
					font-size: 26rpx;
					color: #666;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
					width: 100%;
					text-align: center;
				}
				.goodsPrice{
					font-size: 28rpx;
					color: skyblue;
				}
				.butBtn{
					width: 200rpx;
					line-height: 60rpx;
					background-color: skyblue;
					color: white;
					font-size: 26rpx;
					text-align: center;
					border-radius: 10rpx;
				}
			}
		}
	}
</style>
